package com.last1mile.dao.ibatis.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.stereotype.Component;

import com.last1mile.dao.BaseSqlMapClientDao;
import com.last1mile.dao.interfaces.CityDao;
import com.last1mile.pojo.CityDO;

@Component("cityDao")
public class CityDaoImpl extends BaseSqlMapClientDao implements CityDao {
	@SuppressWarnings("unchecked")
	@Override
	public List<CityDO> selectByCityUpId(String cityUpId) throws SQLException {
		CityDO key = new CityDO();
		key.setCityUpId(cityUpId);
		List<CityDO> records = (List<CityDO>) getSqlMapClientTemplate()
				.queryForList("city.selectByCityUpId", key);
		return records;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table city
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public void insert(CityDO record) throws SQLException {
		getSqlMapClientTemplate().insert("city.abatorgenerated_insert", record);
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table city
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public int updateByPrimaryKey(CityDO record) throws SQLException {
		int rows = getSqlMapClientTemplate().update(
				"city.abatorgenerated_updateByPrimaryKey", record);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table city
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public int updateByPrimaryKeySelective(CityDO record) throws SQLException {
		int rows = getSqlMapClientTemplate().update(
				"city.abatorgenerated_updateByPrimaryKeySelective", record);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table city
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public CityDO selectByPrimaryKey(Integer id) throws SQLException {
		CityDO key = new CityDO();
		key.setId(id);
		CityDO record = (CityDO) getSqlMapClientTemplate().queryForObject(
				"city.abatorgenerated_selectByPrimaryKey", key);
		return record;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table city
	 * 
	 * @abatorgenerated Wed Mar 28 11:37:54 CST 2012
	 */
	public int deleteByPrimaryKey(Integer id) throws SQLException {
		CityDO key = new CityDO();
		key.setId(id);
		int rows = getSqlMapClientTemplate().delete(
				"city.abatorgenerated_deleteByPrimaryKey", key);
		return rows;
	}

}
